// 一个返回当前日期指定格式的函数  如 2022-10-22 15:05:34 
export default function getSelectTime(selectTime?: any) {
  if (!selectTime) return
  let time = new Date(selectTime);  //获取当前日期
  let year: number = time.getFullYear();
  let month: any = time.getMonth() + 1;
  let day: any = time.getDate();
  let hour: any = time.getHours();
  let mintues: any = time.getMinutes();
  let seconds: any = time.getSeconds();

  month > 9 ? month = month : month = `0${month}`     //月不足10，补0 
  day > 9 ? day = day : day = `0${day}`
  hour > 9 ? hour = hour : hour = `0${hour}`
  mintues > 9 ? mintues = mintues : mintues = `0${mintues}`
  seconds > 9 ? seconds = seconds : seconds = '0' + seconds

  let result = `${year}-${month}-${day} ${hour}:${mintues}:${seconds}`;
  // let result=`${year}/${month}/${day} ${hour}:${mintues}:${seconds}`;  
  return result;
}
